<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script>
    var arr = [1,12,3,104,5,6,7,89,50];
     var max = arr[0];
     var min = arr[0];
     for(var i = 0;i<arr.length;i++){
     var cc = arr[i];
     if(cc>max){
     max = cc
     }
     if(cc<min){
     min = cc
     }
     }
     console.log(max);
     console.log(min);
</script>
</body>
</html>